package com.yst.suivi.data.folders;

import javax.ejb.CreateException;
import javax.ejb.EntityBean;

import com.yst.suivi.data.AbstractEntityBean;
import com.yst.suivi.data.project.Project;

/**
 * @author stolf
 * @ejb.bean name="Folder" type="CMP" cmp-version="2.x" schema="folder"
 *           local-jndi-name="FolderBean" view-type="local" primkey-field = "id"
 *           reentrant = "True"
 * @ejb.home generate="local"
 * @ejb.persistence table-name = "folder"
 * @jboss.entity-command name = "key-generator"
 * @jboss.read-ahead eager-load-group = "most" strategy = "on-load"
 *                   page-size="25"
 * @jboss.load-group name="most"
 * @ejb.interface local-extends = "com.yst.suivi.data.util.NamedObject,
 *                javax.ejb.EJBLocalObject"
 * @ejb.finder signature="java.util.Collection
 *             findByProject(com.yst.suivi.data.project.Project usr)"
 *             query="SELECT OBJECT(g) FROM folder AS g WHERE g.project=?1"
 */
public abstract class FolderBean extends AbstractEntityBean implements EntityBean
{
	/**
	 * @return
	 * @throws CreateException
	 * @ejb.create-method view-type = "local"
	 */
	public String ejbCreate() throws CreateException
	{
		return null;
	}

	public void ejbPostCreate()
	{
		// by default nothing to do
	}

	/**
	 * Return the primary key of the object
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getId();

	/**
	 * Fix the primary key of the object. The method should be used only by the
	 * container
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setId(String id);

	/**
	 * Return the name of the object
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getNom();

	/**
	 * Fix the name of the user. The method should be used only by the container
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setNom(String nom);

	/**
	 * La methode lie le folder a un projet
	 * 
	 * @return
	 * @ejb.relation name="folder-projet" role-name = "FolderProjet"
	 *               target-role-name = "FolderProjetRole" target-multiple =
	 *               "yes" target-ejb="Project"
	 * @jboss.relation related-pk-field = "id" fk-constraint = "true" fk-column =
	 *                 "prjId"
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract Project getProject();

	/**
	 * La methode lie le folder a un projet
	 * 
	 * @param plf
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setProject(Project plf);
}
